﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;

namespace Hallenberg.SmartClient.Test
{
    [TestFixture]
    public class BaseSmartClientApplicationTest
    {
        [Test]
        public void SmartClient_BaseSmartClientApplication_RegisterAssembly_PassNull_ExpectFail()
        {
            BaseSmartClientApplication baseSmartClientApplication = new BaseSmartClientApplication();
            
            ArgumentNullException exception = Assert.Throws<ArgumentNullException>(() => baseSmartClientApplication.RegisterAssembly(null));

            Assert.That(exception, Is.Not.Null);
            Assert.That(exception.ParamName, Is.EqualTo("assembly"));
        }

        [Test]
        public void SmartClient_BaseSmartClientApplication_ResoleveRelativePath()
        {
            BaseSmartClientApplication baseSmartClientApplication = new BaseSmartClientApplication();
            string relativePath = @"..\TestPath";

            string absolutePath = baseSmartClientApplication.ResolveRelativePath(relativePath);

            Assert.That(relativePath, Is.EqualTo(absolutePath));
        }

        [Test]
        public void SmartClient_BaseSmartClientApplication_ResoleveRelativePath_PassNull_ExpectFail()
        {
            string absolutePath;

            BaseSmartClientApplication baseSmartClientApplication = new BaseSmartClientApplication();

            ArgumentNullException exception = Assert.Throws<ArgumentNullException>(()=>
                absolutePath = baseSmartClientApplication.ResolveRelativePath(null));

            Assert.That(exception, Is.Not.Null);
            Assert.That(exception.ParamName, Is.EqualTo("relativePath"));
        }
    }
}
